#include "Timer.h"
#include <SDL.h>


// This is the better version of the timer class

Timer::Timer()
{
	m_dt = 0;
	m_previousTicks= 0;
}

Timer::~Timer()
{

}

int Timer::GetFPS()
{
	return 1;
}

void Timer::Update()
{
	float ticksThisFrame = (float)SDL_GetTicks();

	float diff = ticksThisFrame - m_previousTicks;

	float dt = diff * 0.001f;
	if(dt > 0.02f)
	{
		dt = 0.02f;
	}

	m_dt = dt;

	m_previousTicks = ticksThisFrame;
}

float Timer::GetDT() 
{
	return m_dt;
}